import React from 'react';
import { Modal,Button,  } from 'react-bootstrap';

class MyModule extends React.Component{
    // static:{
    //     timer:{},
    // };
    timer:{};
    constructor(){
        super();
        this.state={
            stateshowModal:true,
        };
        this.close= this.close.bind(this);
    }
    componentDidMount(){
        this.timer = setTimeout(
            this.close,
            5000
        );
    }
    componentWillUnmount(){
        this.timer && clearTimeout(this.timer );
    }
    close(){
        console.log(1);
        window.location.href='http://localhost:9000/login';
        this.setState({
            stateshowModal:false,
        })
    }
    render(){
        let _showModal=this.state.stateshowModal&&this.props.showModal;
        return(
            <Modal show={_showModal} onHide={this.close}>
                <Modal.Header closeButton>
                    <Modal.Title>登录成功</Modal.Title>
                </Modal.Header>
                <Modal.Body>
                    <h4>恭喜你，你已经注册成功</h4>
                </Modal.Body>
                <Modal.Footer>
                    <Button onClick={this.close}>Close</Button>
                </Modal.Footer>
            </Modal>
        )
    }
}
export  default MyModule;